/**
 * @author: zouye<yzyngz@foxmail.com>
 * @date: 2022-01-09 18:01:42
 * @copyright: zouye<yzyngz@foxmail.com>
 */
package com.yeah.voice.recognition.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yeah.voice.recognition.common.Result;
import com.yeah.voice.recognition.entity.TbMarkData;
import com.yeah.voice.recognition.service.VoiceService;

/**
 * 每条音频的标记信息保存接口
 */
@RestController
@RequestMapping("mark/")
public class MarkController {
	@Autowired
	private VoiceService voiceService;
	
	/**
	 * 保存标记数据
	 * @param data
	 */
	@RequestMapping("save")
	public Result save(@RequestBody TbMarkData data) {
		if (data.getPeopleId() == null) {
			return Result.fail(403, "请先登录");
		}
		
		try {
			voiceService.saveMark(data);
			return Result.ok();
		} catch(Exception e) {
			e.printStackTrace();
			return Result.fail(500, e.getMessage());
		}
	}
}
